package cn.stylefeng.guns.modular.biz.controller;

import cn.stylefeng.guns.modular.biz.entity.WmMdWarehouse;
import cn.stylefeng.guns.modular.biz.pojo.request.WmMdWarehouseRequest;
import cn.stylefeng.guns.modular.biz.service.WmMdWarehouseService;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.util.List;

/**
 * 煤场基础场地代码控制器
 *
 * @author 张朋飞
 * @since 2024/09/13 16:37
 */
@RestController
@ApiResource(name = "煤场基础场地代码")
public class WmMdWarehouseController {

    @Resource
    private WmMdWarehouseService wmMdWarehouseService;

    /**
     * 添加煤场基础场地代码
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @PostResource(name = "添加煤场基础场地代码", path = "/wmMdWarehouse/add")
    public ResponseData<WmMdWarehouse> add(@RequestBody @Validated(WmMdWarehouseRequest.add.class) WmMdWarehouseRequest wmMdWarehouseRequest) {
        wmMdWarehouseService.add(wmMdWarehouseRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 删除煤场基础场地代码
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @PostResource(name = "删除煤场基础场地代码", path = "/wmMdWarehouse/delete")
    public ResponseData<?> delete(@RequestBody @Validated(WmMdWarehouseRequest.delete.class) WmMdWarehouseRequest wmMdWarehouseRequest) {
        wmMdWarehouseService.del(wmMdWarehouseRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 批量删除煤场基础场地代码
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @PostResource(name = "批量删除煤场基础场地代码", path = "/wmMdWarehouse/batchDelete")
    public ResponseData<?> batchDelete(@RequestBody @Validated(BaseRequest.batchDelete.class) WmMdWarehouseRequest wmMdWarehouseRequest) {
        wmMdWarehouseService.batchDelete(wmMdWarehouseRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑煤场基础场地代码
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @PostResource(name = "编辑煤场基础场地代码", path = "/wmMdWarehouse/edit")
    public ResponseData<?> edit(@RequestBody @Validated(WmMdWarehouseRequest.edit.class) WmMdWarehouseRequest wmMdWarehouseRequest) {
        wmMdWarehouseService.edit(wmMdWarehouseRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 查看煤场基础场地代码详情
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @GetResource(name = "查看煤场基础场地代码详情", path = "/wmMdWarehouse/detail")
    public ResponseData<WmMdWarehouse> detail(@Validated(WmMdWarehouseRequest.detail.class) WmMdWarehouseRequest wmMdWarehouseRequest) {
        return new SuccessResponseData<>(wmMdWarehouseService.detail(wmMdWarehouseRequest));
    }

    /**
     * 获取煤场基础场地代码列表
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @GetResource(name = "获取煤场基础场地代码列表", path = "/wmMdWarehouse/list")
    public ResponseData<List<WmMdWarehouse>> list(WmMdWarehouseRequest wmMdWarehouseRequest) {
        return new SuccessResponseData<>(wmMdWarehouseService.findList(wmMdWarehouseRequest));
    }

    /**
     * 获取煤场基础场地代码列表（带分页）
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @GetResource(name = "获取煤场基础场地代码列表（带分页）", path = "/wmMdWarehouse/page")
    public ResponseData<PageResult<WmMdWarehouse>> page(WmMdWarehouseRequest wmMdWarehouseRequest) {
        return new SuccessResponseData<>(wmMdWarehouseService.findPage(wmMdWarehouseRequest));
    }

}
